unit uniticons;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
  Buttons, StdCtrls, ComCtrls;

type

  TIcon = class
    IconIndex:Integer;   //Index geral de todos os ícones
    //Name: String;
    IconType: String;
    IconTypeNumber: Integer;  //index do método, ex: cokb3d[2]
    PosX: Integer;
    PosY: Integer;
    Input1: Integer;
    Output1: Integer;
  end;
      //  !!!!importante, utilizar a propriedade Tag como index!!!!
  { AddCoord }
         //Done! Fortran 77
  AddCoord = Class(TComponent)
    private
      InputFile: String;
      OutputFile: String;
      RealizationNumber: Integer;
      VarNX: Integer;
      VarNY: Integer;
      VarNZ: Integer;
      VarXMN: Real;
      VarXsiz: Real;
      VarYMN: Real;
      VarYsiz: Real;
      VarZMN: Real;
      VarZsiz: Real;
      procedure SetName(AValue: String);
      procedure SetNX(AValue: Integer);
      procedure SetNY(AValue: Integer);
      procedure SetNZ(AValue: Integer);
      procedure SetRealizationNumber(AValue: Integer);
      procedure SetXMN(AValue: Real);
      procedure SetXsiz(AValue: Real);
      procedure SetYMN(AValue: Real);
      procedure SetYsiz(AValue: Real);
      procedure SetZMN(AValue: Real);
      procedure SetZsiz(AValue: Real);
    public
      IconIndex: Integer;
      VarName: String;
      PosX: Integer;
      PosY: Integer;
    published
       property Name: String read VarName write SetName;
      property Data_File : String read InputFile write InputFile;
      property Output_File : String read OutputFile write OutputFile;
      property Realization_Number : Integer read RealizationNumber write
        SetRealizationNumber;
      property nx : Integer read VarNX write SetNX;
      property xmn : Real read VarXMN write SetXMN;
      property xsiz : Real read VarXsiz write SetXsiz;
      property ny : Integer read VarNY write SetNY;
      property ymn : Real read VarYMN write SetYMN;
      property ysiz : Real read VarYsiz write SetYsiz;
      property nz : Integer read VarNZ write SetNZ;
      property zmn : Real read VarZMN write SetZMN;
      property zsiz : Real read VarZsiz write SetZsiz;
  end;

  { Cokb3d }

  Cokb3d = class(TComponent)
    private
      InputFile: String;
      VarX1: Integer;
      VarX2: Integer;
      procedure SetName(AValue: String);
      procedure SetVarX1(const Avalue: Integer);
      procedure SetVarX2(const AValue: Integer);
    public
      IconIndex: Integer;
      VarName: String;
      PosX: Integer;
      PosY: Integer;
    published
      property Name: String read VarName write SetName;
      property Input : String read InputFile write InputFile;
      property X1: Integer read VarX1 write SetVarX1;
      property X2: Integer read Varx2 write SetVarX2;
  end;

  InputFile = class(TComponent)
    //MethodOutput: String;  String, Index ou TComponent?
  end;

  OutputFile = class(TComponent)
    //MethodInput: String;
  end;

  { TForm2 }

  TForm2 = class(TForm)
    GroupBoxFileToolBar: TGroupBox;
    GroupBoxMethodToolBar: TGroupBox;
    GroupBoxPlotToolBar: TGroupBox;
    Panel1: TPanel;
    SpeedButton1: TSpeedButton;
    SpeedButton2: TSpeedButton;
    SpeedButtonInputFIle: TSpeedButton;
    SpeedButtonOutputFile: TSpeedButton;
    SpeedButtonCokb3d: TSpeedButton;
    ToolBar1: TToolBar;
    ToolBar2: TToolBar;
    ToolBar3: TToolBar;
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
    procedure SpeedButtonCokb3dClick(Sender: TObject);
    procedure SpeedButtonInputFIleClick(Sender: TObject);
    procedure SpeedButtonOutputFileClick(Sender: TObject);
  private
    { private declarations }
  public
    MethodClicked: Boolean;
    SelectedIcon: String; // qual o metodo, arquivo, plot selecionado
    { public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.lfm}


{ Tratamento das propriedades dos objetos:
  -Sempre fazer AValue:=Trim(AValue) para nomes e outras strings(nao tem dado certo

}

{ AddCoord }

procedure AddCoord.SetRealizationNumber(AValue: Integer);
begin
  if RealizationNumber=AValue then Exit;
  RealizationNumber:=AValue;
end;

procedure AddCoord.SetXMN(AValue: Real);
begin
  if VarXMN=AValue then Exit;
  VarXMN:=AValue;
end;

procedure AddCoord.SetXsiz(AValue: Real);
begin
  if VarXsiz=AValue then Exit;
  VarXsiz:=AValue;
end;

procedure AddCoord.SetYMN(AValue: Real);
begin
  if VarYMN=AValue then Exit;
  VarYMN:=AValue;
end;

procedure AddCoord.SetYsiz(AValue: Real);
begin
  if VarYsiz=AValue then Exit;
  VarYsiz:=AValue;
end;

procedure AddCoord.SetZMN(AValue: Real);
begin
  if VarZMN=AValue then Exit;
  VarZMN:=AValue;
end;

procedure AddCoord.SetZsiz(AValue: Real);
begin
  if VarZsiz=AValue then Exit;
  VarZsiz:=AValue;
end;

procedure AddCoord.SetNX(AValue: Integer);
begin
  if VarNX=AValue then Exit;
  VarNX:=AValue;
end;

procedure AddCoord.SetName(AValue: String);
begin
  AValue:=Trim(Avalue);
  if VarName=AValue then Exit;
  VarName:=AValue;
end;

procedure AddCoord.SetNY(AValue: Integer);
begin
  if VarNY=AValue then Exit;
  VarNY:=AValue;
end;

procedure AddCoord.SetNZ(AValue: Integer);
begin
  if VarNZ=AValue then Exit;
  VarNZ:=AValue;
end;

{ Cokb3d }

procedure Cokb3d.SetVarX1(const Avalue: Integer);
begin
  if VarX1= AValue then exit;
  VarX1:= AValue;
end;

procedure Cokb3d.SetName(AValue: String);
begin
  AValue:=Trim(Avalue);
  if VarName=AValue then Exit;
  VarName:=AValue;
end;

procedure Cokb3d.SetVarX2(const AValue: Integer);
begin
  if Varx2=AValue then Exit;
  Varx2:=AValue;
end;

{ TForm2 }

procedure TForm2.SpeedButton1Click(Sender: TObject);
begin
  SelectedIcon:='kringing';
  MethodClicked:= True;
end;

procedure TForm2.SpeedButton2Click(Sender: TObject);
begin
  SelectedIcon:='addcoord';
  MethodClicked:= True;
end;

procedure TForm2.SpeedButtonCokb3dClick(Sender: TObject);
begin
  SelectedIcon:='cokb3d';
  MethodClicked:= True;
end;

procedure TForm2.SpeedButtonInputFIleClick(Sender: TObject);
begin
  SelectedIcon:='Input File';
  MethodClicked:= True;
end;

procedure TForm2.SpeedButtonOutputFileClick(Sender: TObject);
begin
  SelectedIcon:='Output File';
  MethodClicked:= True;
end;

end.
